package com.example.twoeightgang;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class SettingsActivity extends Activity {
    private ListView listView;
    private ArrayAdapter settingAdapter;
    private String user;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.setting_layout);
        listView=(ListView)findViewById(R.id.lv_1);
//        ArrayList<HashMap<String,Object>> arrayList=new ArrayList<HashMap<String,Object>>();
//        HashMap<String,Object> map=new HashMap<String,Object>();
//        CheckBox checkBox=new CheckBox(this);
//        map.put("list1",checkBox);
//        arrayList.add(map);
//        TextView textView1=new TextView(this);
//        map.put("list2",textView1);
//        arrayList.add(map);
        settingAdapter=new ArrayAdapter<String>(this,R.layout.support_simple_spinner_dropdown_item,
                new String[]{getResources().getString(R.string.baocunchongxinkaishi),getResources().getString(R.string.paiming)});
        listView.setAdapter(settingAdapter);
        Intent mIntent=getIntent();
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                switch(position){
                    case 0:
                        Intent mIntent=getIntent();
                        user = mIntent.getStringExtra("username");
                        Log.d("uuuu11","user = " + user);
                        BaoCunDialog baocunDialog=new BaoCunDialog(SettingsActivity.this, user);
                        baocunDialog.setView(new EditText(SettingsActivity.this));
                        baocunDialog.show();
                        break;
                    case 1:
                        Intent iIntent=getIntent();
                        iIntent.setClass(SettingsActivity.this,PaimingActivity.class);
                        startActivity(iIntent);
                        break;
                        default:
                            break;
                }
            }
        });
    }

}
